package network;



import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import core.Main;

@SuppressWarnings("unused")
public class HttpGetter {
	private String strHour;
	private String strMinute;

	public HttpGetter(){

	}
	void sendGetMsg(String day, int hour, int minute)
	{

		if(hour < 10){
			strHour = "0" + Integer.toString(hour);
		}
		else
			strHour = Integer.toString(hour);
		if(minute < 10){
			strMinute = "0" + Integer.toString(minute);
		}
		else 
			strMinute = Integer.toString(minute);

		try {
			HttpClient client = new DefaultHttpClient();  
			String getURL ="http://"+ Main.getIpAdress()+ "/?time" + day + "=" + strHour + "." + strMinute ;
			//HttpGet get = new HttpGet(getURL);
			//client.execute(get);  
			System.out.println(getURL);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public void sendStop(){
		try {
			HttpClient client = new DefaultHttpClient();  
			String getURL = "http://" + Main.getIpAdress() + "/?timeStop";
		//	HttpGet get = new HttpGet(getURL);
			//client.execute(get);  
			System.out.println(getURL);

		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	public void sendStart(){
		try {
			HttpClient client = new DefaultHttpClient();  
			String getURL = "http://"+ Main.getIpAdress() +"/?timeStart";
			//HttpGet get = new HttpGet(getURL);
			//client.execute(get);  
			System.out.println(getURL);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

	public void sendAuto(){
		try {
			HttpClient client = new DefaultHttpClient();  
			String getURL = "http://" + Main.getIpAdress() +"/?timeAuto";
			//HttpGet get = new HttpGet(getURL);
			//client.execute(get);  
			System.out.println(getURL);
		} catch (Exception e) {
			e.printStackTrace();
		}

	}

}
